package computerdatabase // 1

// 2

import io.gatling.core.Predef._
import io.gatling.http.Predef._

import scala.io.Source

class BasicSimulation extends Simulation { // 3

//val  jsonmap=Map{"Content-Type"->"application/x-www-form-urlencoded"}

  val httpProtocol = http // 4
    .baseUrl("http://localhost:8081") // 5
//      .acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") // 6
//      .doNotTrackHeader("1")
//      .acceptLanguageHeader("en-US,en;q=0.5")
//      .acceptEncodingHeader("gzip, deflate")
//      .userAgentHeader("Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0")

  val scn = scenario("BasicSimulation") // 7
    .exec(
      http("request_1") // 8
        .post("/upload")
//        .headers(jsonmap)
        .queryParam("file", Source.fromFile("/Users/liwen406/jmeter.log").toString())
    ).pause(5) // 10

  setUp( // 11
    scn.inject(atOnceUsers(1)) // 12
  ).protocols(httpProtocol) // 13


}
